﻿using System;
using System.Runtime.InteropServices;
using DataService.Enums;

namespace DataService.Structs;

[StructLayout(LayoutKind.Sequential)]
public struct TagMetaData : IComparable<TagMetaData>
{
    public bool Archive;

    public DataType DataType;

    public ushort Size;

    public short ID;

    public short GroupID;

    public float Maximum;

    public float Minimum;

    public int Cycle;

    public string Address;

    public string Name;

    public TagMetaData(short id, short grpId, string name, string address, DataType type, ushort size, bool archive = false, float max = 0, float min = 0, int cycle = 0)
    {
        ID = id;
        GroupID = grpId;
        Name = name;
        Address = address;
        DataType = type;
        Size = size;
        Archive = archive;
        Maximum = max;
        Minimum = min;
        Cycle = cycle;
    }

    public int CompareTo(TagMetaData other)
    {
        return ID.CompareTo(other.ID);
    }

    public override string ToString()
    {
        return Name;
    }
}
